Skip to content

8382616: Create GCArguments::set_heap_size interface#30848

Closed
xmas92 wants to merge 4 commits intoopenjdk:masterfrom
xmas92:zgc_ahs_upstream_gcarguments_refactor
Closed

8382616: Create GCArguments::set_heap_size interface#30848
xmas92 wants to merge 4 commits intoopenjdk:masterfrom
xmas92:zgc_ahs_upstream_gcarguments_refactor

Conversation

@xmas92
Copy link
Copy Markdown
Member

@xmas92 xmas92 commented Apr 21, 2026

Move the static Arguments::set_heap_size() to be a virtual interface on GCArguments via GCArguments::set_heap_size() with a a base implementation which is the same as the current Arguments::set_heap_size().

The main motivation is to allow the GCs to modify the behaviour of heap selection. This is something we rely on for the automatic heap sizing implementation in ZGC (JDK-8380289).

To keep the code motion minimal here Arguments friends GCArguments so it can use shared code without expanding its public interface. There is probably room for improvement here. But unless someone has a strong objections, or a trivial solution here, I would prefer keeping that to separate RFE.

Testing:

  • GHA
  • Tier 1-3 Oracle supported platforms


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (2 reviews required, with at least 1 Reviewer, 1 Author)

Issue

  • JDK-8382616: Create GCArguments::set_heap_size interface (Enhancement - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/30848/head:pull/30848
$ git checkout pull/30848

Update a local copy of the PR:
$ git checkout pull/30848
$ git pull https://git.openjdk.org/jdk.git pull/30848/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 30848

View PR using the GUI difftool:
$ git pr show -t 30848

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/30848.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link
Copy Markdown

bridgekeeper Bot commented Apr 21, 2026

👋 Welcome back aboldtch! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link
Copy Markdown

openjdk Bot commented Apr 21, 2026

@xmas92 This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8382616: Create GCArguments::set_heap_size interface

Reviewed-by: jsikstro, ayang

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 54 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk Bot added the hotspot hotspot-dev@openjdk.org label Apr 21, 2026
@openjdk
Copy link
Copy Markdown

openjdk Bot commented Apr 21, 2026

@xmas92 The following label will be automatically applied to this pull request:

  • hotspot

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk
Copy link
Copy Markdown

openjdk Bot commented Apr 21, 2026

The total number of required reviews for this PR has been set to 2 based on the presence of this label: hotspot. This can be overridden with the /reviewers command.

@openjdk openjdk Bot added the rfr Pull request is ready for review label Apr 21, 2026
@mlbridge
Copy link
Copy Markdown

mlbridge Bot commented Apr 21, 2026

Webrevs

@jsikstro
Copy link
Copy Markdown
Member

We should update the comment here to reflect that the function has moved from Arguments to GCArguments:

// If an overflow happened in Arguments::set_heap_size(), MaxHeapSize will have too large a value.

Copy link
Copy Markdown
Member

@jsikstro jsikstro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

When #30768 is integrated we can move limit_heap_by_allocatable_memory to GCArguments.

@albertnetymk
Copy link
Copy Markdown
Member

/cc hotspot-gc

@openjdk openjdk Bot added the hotspot-gc hotspot-gc-dev@openjdk.org label Apr 22, 2026
@openjdk
Copy link
Copy Markdown

openjdk Bot commented Apr 22, 2026

@albertnetymk
The hotspot-gc label was successfully added.

@xmas92
Copy link
Copy Markdown
Member Author

xmas92 commented Apr 22, 2026

Merged in JDK-8381829 / #30768 and moved limit_heap_by_allocatable_memory to GCArguments and removed the friend class declaration.

@openjdk openjdk Bot added the ready Pull request is ready to be integrated label Apr 27, 2026
@xmas92
Copy link
Copy Markdown
Member Author

xmas92 commented Apr 27, 2026

Thanks for the reviews.
/integrate

@openjdk
Copy link
Copy Markdown

openjdk Bot commented Apr 27, 2026

Going to push as commit 02c1fde.
Since your change was applied there have been 67 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk Bot added the integrated Pull request has been integrated label Apr 27, 2026
@openjdk openjdk Bot closed this Apr 27, 2026
@openjdk openjdk Bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Apr 27, 2026
@openjdk
Copy link
Copy Markdown

openjdk Bot commented Apr 27, 2026

@xmas92 Pushed as commit 02c1fde.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotspot hotspot-dev@openjdk.org hotspot-gc hotspot-gc-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants